/*
 * cutil.c
 *
 *  Created on: 2011-1-8
 *      Author: zhang
 */

#include "cutil.h"
#include <sys/time.h>

double getTimeUsed(struct timeval start,struct timeval end)
{
	double timeuse = 1000000 * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec;
	timeuse /= 1000000;
	//double sec = (double) time / CLOCKS_PER_SEC;
  /*
	printf("%s %.4f\n",message,timeuse);

  FILE* f = fopen("time.dat","wb");
  fwrite(&timeuse,sizeof(double),1,f);
  fclose(f);
   */
  return timeuse;
}
